'use strict';

const Controller = require('egg').Controller;

class whjchoice extends Controller {
  async index() {
    const data = await this.ctx.service.whjchoice.findAll(this.ctx);
    this.ctx.body = data;
  }
  async create() {
    const ctx = this.ctx;
    const params = ctx.request.body;
    const data = await ctx.service.whjchoice.create(params);
    ctx.body = data;
  }
  async destroy() {
    const ctx = this.ctx;
    const whjchoiceId = ctx.params.id;
    const del = await ctx.service.whjchoice.delete(whjchoiceId);
    ctx.body = del;
  }
  async update() {
    const ctx = this.ctx;
    const whjchoiceId = ctx.params.id;
    const params = ctx.request.body;
    const change = await ctx.service.whjchoice.update(whjchoiceId, params);
    ctx.body = change;
  }
  async show() {
    const ctx = this.ctx;
    const id = ctx.params.id;
    const whjchoice = await this.ctx.service.whjchoice.find(id);
    ctx.body = whjchoice;
  }
  async index0() {
    const ctx = this.ctx;
    const pass = ctx.params.age;
    console.log(pass);
    const data = await this.ctx.service.whjchoice.findAll0(pass);
    this.ctx.body = data;
  }
}
module.exports = whjchoice;
